﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CMP.ERP.DAL;
using System.Data;
using CMP.ERP.Model;

namespace CMP.ERP.BLL
{
    /// <summary>
    /// 商品信息
    /// </summary>
    public class CommodityBLL
    {
        CMP.ERP.DAL.CommodityDAL dal = new CommodityDAL();
        /// <summary> 
        /// 获取商品信息
        /// </summary>
        /// <returns></returns>
        public List<Commodity> GetCommodityAll()
        {            
            return dal.GetCommodityAll();
        }
        /// <summary>
        /// 添加商品信息
        /// </summary>
        /// <param name="e"></param>
        /// <returns></returns>
        public int AddCommodity(Commodity c)
        {
            return dal.AddCommodity(c);
        }
        /// <summary>
        /// 获取商品类型
        /// </summary>
        /// <returns></returns>
        public List<CommodityType> GetCommodityTypeAll()
        {
            return dal.GetCommodityTypeAll();
        }
        /// <summary>
        /// 删除商品信息
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public int DelCommodity(int id)
        {
            return dal.DelCommodity(id);
        }
        /// <summary>
        /// 根据id获取单行数据
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public Commodity GetCommodityById(int id)
        {
            return dal.GetCommodityById(id);
        }
        /// <summary>
        /// 更新商品信息
        /// </summary>
        /// <param name="c"></param>
        /// <returns></returns>
        public int EditCommodity(Commodity c)
        {
            return dal.EditCommodity(c);
        }
        /// <summary>
        /// 根据商品名称查询商品信息
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public List<Commodity> SearchByName(string name)
        {
            return dal.SearchByName(name);
        }
        /// <summary>
        /// 搜索
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public DataTable Search(int num)
        {
            return dal.Search(num);
        }
    }
}
